/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.factory.server.algorithms;

import com.factory.server.dto.EdgeDTO;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import org.jgrapht.graph.DefaultWeightedEdge;
import org.jgrapht.graph.DirectedWeightedMultigraph;

/**
 * Each graph algorithm capsulate result to this class
 *
 * @author milos
 */
public class GraphProblemresult {

    List<EdgeDTO> edges;
    private double cost;
    private List<EdgeDTO> spanningTree;
    private List<EdgeDTO> shortestPath;
    private DirectedWeightedMultigraph graph;
    private List<Integer> nodesList;
    private boolean negativeCycle = true;

    public GraphProblemresult() {
        edges = new ArrayList<EdgeDTO>();
        shortestPath = new ArrayList<EdgeDTO>();
        this.graph = new DirectedWeightedMultigraph<String, DefaultWeightedEdge>(DefaultWeightedEdge.class);
        nodesList = new ArrayList<Integer>();
    }

    public double getCost() {
        return cost;
    }

    public void setCost(double cost) {
        this.cost = cost;
    }

    public List<EdgeDTO> getSpanningTree() {
        return spanningTree;
    }

    public void setSpanningTree(List<EdgeDTO> spanningTree) {
        this.spanningTree = spanningTree;
    }

    public BigInteger getEdgeWeight(DefaultWeightedEdge edge) {
        return BigInteger.valueOf((long) graph.getEdgeWeight(edge));
    }

    public void setGraph(DirectedWeightedMultigraph<String, DefaultWeightedEdge> graph) {
        this.graph = graph;
    }

    public List<EdgeDTO> getEdges() {
        return edges;
    }

    public void setEdges(List<EdgeDTO> edges) {
        this.edges = edges;
    }

    public List<EdgeDTO> getShortestPath() {
        return shortestPath;
    }

    public void setShortestPath(List<EdgeDTO> shortestPath) {
        this.shortestPath = shortestPath;
    }

    public List<Integer> getNodesList() {
        return nodesList;
    }

    public void setNodesList(List<Integer> nodesList) {
        this.nodesList = nodesList;
    }

    public DirectedWeightedMultigraph getGraph() {
        return graph;
    }

    public boolean hasNegativeCycle() {
        return negativeCycle;
    }

    public void setNegativeCycle(boolean negativeCycle) {
        this.negativeCycle = negativeCycle;
    }
}
